package jmine.tec.web.wicket.pages.main;

import org.apache.wicket.RequestCycle;
import org.apache.wicket.Session;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.request.target.basic.RedirectRequestTarget;

import bancosys.tec.security.SecurityURLMapping;

/**
 * WebPage que invalida a session
 * 
 * @author takeshi
 */
public class Logout extends WebPage {

    /**
     * 
     */
    public Logout() {
        Session.get().invalidate();
        RequestCycle.get().setRedirect(true);
        if (SecurityURLMapping.getInstance().getLogoutURL() != null) {
            RequestCycle.get().setRequestTarget(new RedirectRequestTarget(SecurityURLMapping.getInstance().getLogoutURL()));
        } else {
            this.setResponsePage(Login.class);
        }
    }

}
